<template>
  <el-container class="account">
    <el-header>
      <el-menu mode="horizontal" @select="handleSelect">
        <el-menu-item index="home">返回首页</el-menu-item>
        <el-button-group class="btnGroup">
          <el-button round @click="toLogin()">去登录</el-button>
          <el-button round @click="toRegister()">去注册</el-button>
        </el-button-group>
      </el-menu>
    </el-header>
    <el-main>
      <router-view/>
    </el-main>
  </el-container>
</template>

<script>
import {LocalService} from '@/service/api'

export default {
  data () {
    return {
      activeIndex: 'home'
    }
  },
  methods: {
    toResetPass: function () {
      // todo reset password
    },
    toLogin: function () {
      this.$router.push({path: '/account/login'})
    },
    toRegister: function () {
      this.$router.push({path: '/account/register'})
    },
    handleSelect: function (key, keyPath) {
      LocalService.SaveIndexPath('home')
      if (key === 'home') {
        this.$router.push({path: '/home'})
      }
    }
  }
}
</script>

<style scoped>
  .btnGroup{
    height: 100%;
    float:right;
    margin-left:10%;
  }
</style>
